import React, {useState} from "react";
import {ProForm, ProFormText} from "@ant-design/pro-components";
import {message, Space} from "antd";

const SceneModal = (props) => {
    // 在这里可以访问传递的数据
    const receivedData = props.data;
    const [sceneName, setSceneName] = useState('');
    return (
        <Space direction={"vertical"} align={"center"} style={{"width": "100%", "margin-top": "1.5%"}}>
            <ProForm
                onFinish={async (values) => {
                    console.log(values);
                    const result = await window.tm?.ipcRenderer.invoke('createScene', sceneName);
                    console.log("result", result)
                    await window.tm?.ipcRenderer.invoke('closeObsModal', sceneName);
                }}
                initialValues={{
                    name: '新建场景',
                }}
            >
                <ProFormText
                    width="md"
                    name="sceneName"
                    label="请输入场景名称"
                    placeholder="请输入场景名称"
                    rules={[{required: true}]}
                    onChange={(e) => {
                        console.log("eeee", e.target.value)
                        setSceneName(e.target.value);
                    }}
                />
            </ProForm>
        </Space>
    );
};

export default SceneModal;